﻿using System;
using CkSoftware.GroupMe.Sdk.Core.Dao;
using CkSoftware.GroupMe.Sdk.Messaging;
using Newtonsoft.Json;

namespace CkSoftware.GroupMe.Sdk.Groups.Dao
{
	/// <summary>
	/// The member data of a single group user.
	/// </summary>
	public class GroupMemberData
	{
		/// <summary>
		/// Defines if the user was autokicked.
		/// </summary>
		[JsonProperty(PropertyName = "autokicked")]
		public bool AutoKicked { get; set; }

		/// <summary>
		/// The <see cref="PictureData" /> for the user avatar.
		/// </summary>
		[JsonIgnore]
		public PictureData AvatarImage
		{
			get { return new PictureData {Url = AvatarUrl}; }
		}

		/// <summary>
		/// The image-url for the user avatar.
		/// </summary>
		[JsonProperty(PropertyName = "image_url")]
		public string AvatarUrl { get; set; }

		/// <summary>
		/// The id of this user in the given group (this is a changing id from group to group, the UserId member shows the unique user id).
		/// </summary>
		[JsonProperty(PropertyName = "id")]
		public string Id { get; set; }

		/// <summary>
		/// Defines if this user is in muted state.
		/// </summary>
		[JsonProperty(PropertyName = "muted")]
		public bool Muted { get; set; }

		/// <summary>
		/// The nickname of the user in the given group.
		/// </summary>
		[JsonProperty(PropertyName = "nickname")]
		public string Nickname { get; set; }

		/// <summary>
		/// The globally unique user id.
		/// </summary>
		[JsonProperty(PropertyName = "user_id")]
		public string UserId { get; set; }

		/// <summary>
		/// The <see cref="GroupMeDirectMessages" /> from the authenticated user to this user (and vice versa).
		/// </summary>
		[JsonIgnore]
		public Lazy<GroupMeDirectMessages> Messages { get; set; }
	}
}